#ifndef GRAPHWIDGET_H
#define GRAPHWIDGET_H

#include <QGraphicsView>
#include <QKeyEvent>
#include <QMouseEvent>
#include <QPainter>
#include <QRectF>
#include <QGraphicsScene>
#include <QPoint>
#include <QAction>
#include <QList>

#include "global.h"
#include "coorditem.h"

class GraphWidget : public QGraphicsView
{
    Q_OBJECT

public:
    GraphWidget(QWidget *parent = 0);

protected:
    void keyPressEvent(QKeyEvent *event);
    void keyReleaseEvent(QKeyEvent *event);
    void mousePressEvent(QMouseEvent *event);
    void drawBackground(QPainter *painter, const QRectF &rect);
//    void contextMenuEvent(QContextMenuEvent *event);

private:
    QGraphicsScene *scene;
    bool ctrlDown;
    bool altDown;
    bool shiftDown;
    bool coordVisible;
    QAction *actHideCoord;
    QAction *actClearAll;
    QAction *actClose;
    QAction *actActiveAddDots;
    QAction *actActiveDelete;
    QAction *actActiveAddLines;
    QAction *actSave2Image;
    QPoint lastPoint;
    int pointIndex;
//    QList <CoordItem *> *coordList;

    void mouseLeftClicked();
//    CoordItem *mouseC;

signals:

public slots:
    void setCoordVisible();
    void clearAllItems();
    void activeAddDots();
    void activeDelete();
    void activeAddLines();
    void save2Image();
};

#endif // GRAPHWIDGET_H
